const app = getApp();
Page({
    data: {
        userInfo:{}

    },
    onLoad: function () {
        this.setData({
            userInfo:wx.getStorageSync('userInfo')
        })

        wx.setNavigationBarTitle({
            title: '我的'
        })
    },
    logout:function () {
        wx.showLoading({
            title: '正在注销',
        });
        var that = this;
        wx.request({
            url: app.globalData.APIURL + '/vending-admin/admin/login/logout',
            data: {
                token: app.globalData.token,
                type:1
            },
            // method:'GET',
            header: {
                'content-type': 'application/json' // 默认值
            },
            success: function (res) {
                //停止刷新
                // wx.stopPullDownRefresh();
                wx.hideLoading();
                if(app.requestEro(res.data.success,res.data.msg)){
                    wx.showToast({
                        title: '已安全退出',
                        icon: 'success',
                        duration: 2000,
                    });
                    setTimeout(function(){
                        wx.reLaunch({
                            url:'/pages/login/login'
                        })
                    },1000)

                }
            },
            fail: function (err) {
                console.log(err);
                wx.hideLoading();
            }
        })


    }
})